<template>
  <div class="home">
    <div class="daohang">
      <div class="iconfont_caidan"></div>
      <div class="search">
        <input type="text" placeholder="云南虫谷">
        <button @click="Tosearch"></button>
      </div>
    </div>
    
    <router-view></router-view>
    <recommend />
    <Recommend_list />
    <lunboView />
  </div>
</template>

<style scoped>
.home {
  height: 100vh;
  overflow: scroll;
  width: 100%;
}

.search {
  margin-top: 45px;
  margin-bottom: 10px;
  border-radius: 50px;
  height: 35px;
  width: 70%;
  background-color: white;
  display: inline-flex;
  text-align: right;
}

.search input {
  border: 0;
  outline: none;
  height: 35px;
  border-radius: 50px;
  padding-left: 20px;
  width: 78%;
  left: 0;
  text-align: left;
  margin-right: 35px;
  display: inline-block;
}

.search button {
  width: 25px;
  height: 25px;
  background-color: transparent;
  transform: translate(-50%, 20%);
  background-image: url(../img/search.png);
  background-repeat: no-repeat;
  background-size: cover;
  border: 0;
  outline: none;
  padding: 0;
  position: relative;
  display: inline-block;
}

.iconfont_caidan {
  width: 30px;
  height: 30px;
  background-image: url(../img/辣椒.png);
  bottom: -9px;
  position: relative;
  background-repeat: no-repeat;
  background-size: cover;
  display: inline-block;
  margin-right: 10px;
}
</style>

<script>
// 为你推荐
import Recommend_list from '@/components/recommend_list.vue';
import recommend from './recommendView.vue';
import lunboView from '../components/luboView.vue'

export default {
  components: {
    recommend,
    Recommend_list,
    lunboView,
  },
  data() {
    return {
      msg1: "Hello",
      active:true,
      isShow: true,
    }
  },
  methods: {
    Tosearch() {
      let myVlaue = document.querySelector(".search input").value;
      console.log(myVlaue);
      if(!myVlaue){
        this.$router.push({ path: '/day_recommend'});
      }
      this.$router.push({ path: '/search',query:{myVlaue}});
    },
  },
}
</script>
